x
editorCache.push(editor);module teapo.docs.types.text { export function load(fullPath: string, read: (property: string) => string, write: (property: string, content: string) => void): DocumentHandler { return null; } export class TextDocumentHandler implements DocumentHandler {​ private _doc: CodeMirror.Doc = null; private _text: string = null; private _editor: { cm: CodeMirror; host: HTMLElement; } = null;​ constructor( private _read: (property: string) => string, private _write: (property: string, content: string) => void) { } getText() { if (this._text === null) { if (this._doc) this._text = this._doc.getValue(); else this._text = this._read(null); } return this._text; } getDoc() { if (!this._doc) { this._doc = new CodeMirror.Doc(this.getText()); // TODO: process history and/or cusor/scroll position } return this._doc; }​ open(): HTMLElement {​ return this._getEditor().host; }​ close() { if (this._editor) { var e = this._editor; this._editor = null; returnEditor(e); } }​ private _getEditor() {